package com.zhanglijie.theory.immutable;

/**
 * @author zhanglijie
 * @version 1.0
 * @since 1.1.0 2022/7/22 0022 22:00
 */
public class PrintPersonTest extends Thread {

    private Person person;

    public PrintPersonTest(Person person) {
        this.person = person;
    }

    @Override
    public void run() {
        while (true) {
            System.out.println(Thread.currentThread().getName() + "print" + person);
        }
    }

    static class Main {
        public static void main(String[] args) {
            Person person = new Person("alice", "Alaska");
            new PrintPersonTest(person).start();
            new PrintPersonTest(person).start();
            new PrintPersonTest(person).start();
        }
    }
}
